from simpy import Environment, Store

from x_pc.core.unit import Unit


class JXCJ(Unit):
    """
    204 件箱层接驳口
    件箱层接(JXCJ)
    """
    # 缓存
    store: Store = None

    # 层
    layer: int = None

    def __init__(self, env: Environment, name: str, layer: int, kwargs):
        super().__init__(env, name, kwargs)
        self.layer = layer
        self.store = Store(env, self.cache_nums())

    def is_full(self) -> bool:
        return len(self.store.items) == self.cache_nums()

    def is_empty(self) -> bool:
        return len(self.store.items) == 0

    @staticmethod
    def device_type() -> int:
        return 204
